<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Animoso.Domain.Sponsor>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <h4>Sponsoren</h4>
 <fieldset>
    <table>
    <% foreach (var sponsor in Model)
    {
           %>
        <tr id="sponsor_<%=sponsor.Id %>">
            <td><b><%=sponsor.Name %></b></td>
            <td><%=sponsor.ImageLocation %></td>            
            <td><a href="<%=Url.Action("Edit", "Sponsor", new { id = sponsor.Id}) %>"><img src="Content/Images/Text-Edit-icon.png" /></a></td>
            <td><a id="delete_<%=sponsor.Id %>" class="deleteSponsor" href="#"><img src="Content/Images/File-Delete-icon.png" /></a></td>
        </tr>
    <% } %>        
    </table>
 </fieldset>
 <p>
        <%= Html.ActionLink("Nieuwe Sponsor", "Create") %>
 </p>
    
<script type="text/javascript">
    $('.deleteSponsor').click(function(event) {
    var sponsorId = this.id.split('_')[1];    

    $.ajax({ url: "Sponsor/Delete", data: "sponsorId=" + sponsorId, context: document.body,
        success: function(val) {
        $('#sponsor_' + sponsorId).remove();
        }
    });
});
$('.deleteSponsor').confirm();
</script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
</asp:Content>
